﻿using System;
using Epam.PeopleInterfaces;

namespace Epam.BusinessLogic
{
    public class Algoritms:IFilterAlgoritm,INewsSkipAlgoritm
    {
        public double FiltrateByFactor(double weight, double hight)
        {
            return Math.Round(weight/Math.Pow(hight, 2),4,MidpointRounding.ToEven);
        }

        public string SkipNews(string news)
        {
            if (news.Length > 50)
            {
                int length = 50;
                while (news[length] != ' ') length++;
                return news.Substring(0, length);
            }
            return news;
        }
    }
}
